/**
 * Licensee: avaj llik
 * License Type: Purchased
 */
package ormsamples;

import org.orm.*;
public class ListTallerdeSOAData {
	private static final int ROW_COUNT = 100;
	
public void listTestData() throws PersistentException {
		orm.DAOFactory lDAOFactory = orm.DAOFactory.getDAOFactory();
		System.out.println("Listing Tcp_publicacion...");
		orm.Tcp_publicacion[] ormTcp_publicacions = lDAOFactory.getTcp_publicacionDAO().listTcp_publicacionByQuery(null, null);
		int length = Math.min(ormTcp_publicacions.length, ROW_COUNT);
		for (int i = 0; i < length; i++) {
			System.out.println(ormTcp_publicacions[i]);
		}
		System.out.println(length + " record(s) retrieved.");
		
		System.out.println("Listing Tcp_persona...");
		orm.Tcp_persona[] ormTcp_personas = lDAOFactory.getTcp_personaDAO().listTcp_personaByQuery(null, null);
		length = Math.min(ormTcp_personas.length, ROW_COUNT);
		for (int i = 0; i < length; i++) {
			System.out.println(ormTcp_personas[i]);
		}
		System.out.println(length + " record(s) retrieved.");
		
	}
	
	public void listByCriteria() throws PersistentException  {
		System.out.println("Listing Tcp_publicacion by Criteria...");
		orm.Tcp_publicacionCriteria tcp_publicacionCriteria = new orm.Tcp_publicacionCriteria();
		// Please uncomment the follow line and fill in parameter(s) 
		//tcp_publicacionCriteria.pub_id.eq();
		tcp_publicacionCriteria.setMaxResults(ROW_COUNT);
		orm.Tcp_publicacion[] ormTcp_publicacions = tcp_publicacionCriteria.listTcp_publicacion();
		int length =ormTcp_publicacions== null ? 0 : Math.min(ormTcp_publicacions.length, ROW_COUNT); 
		for (int i = 0; i < length; i++) {
			 System.out.println(ormTcp_publicacions[i]);
		}
		System.out.println(length + " Tcp_publicacion record(s) retrieved."); 
		
		System.out.println("Listing Tcp_persona by Criteria...");
		orm.Tcp_personaCriteria tcp_personaCriteria = new orm.Tcp_personaCriteria();
		// Please uncomment the follow line and fill in parameter(s) 
		//tcp_personaCriteria.pers_id.eq();
		tcp_personaCriteria.setMaxResults(ROW_COUNT);
		orm.Tcp_persona[] ormTcp_personas = tcp_personaCriteria.listTcp_persona();
		length =ormTcp_personas== null ? 0 : Math.min(ormTcp_personas.length, ROW_COUNT); 
		for (int i = 0; i < length; i++) {
			 System.out.println(ormTcp_personas[i]);
		}
		System.out.println(length + " Tcp_persona record(s) retrieved."); 
		
	}
	
	public static void main(String[] args) {
		try {
			ListTallerdeSOAData listTallerdeSOAData = new ListTallerdeSOAData();
			try {
				listTallerdeSOAData.listTestData();
				//listTallerdeSOAData.listByCriteria();
			}
			finally {
				orm.TallerdeSOAPersistentManager.instance().disposePersistentManager();
			}
		}
		catch (Exception e) {
			e.printStackTrace();
		}
	}
}
